Imports System.ServiceProcess

Public Class GPSFileService

    Protected Overrides Sub OnStart(ByVal args() As String)
        ' Add code here to start your service. This method should set things
        ' in motion so your service can do its work.
        Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser("C:\Documents and Settings\pklein\Persoonlijk\Warns\GPSInput.txt")
            MyReader.TextFieldType = FileIO.FieldType.Delimited
            MyReader.SetDelimiters(",")
            Dim currentRow As String()
            While Not MyReader.EndOfData
                Try
                    currentRow = MyReader.ReadFields()
                    Dim currentField As String
                    For Each currentField In currentRow
                        Dim SterPositie As Integer
                        SterPositie = InStr(currentField, "*", CompareMethod.Text)
                        If SterPositie > 0 Then
                            MsgBox("ControleGetal gevonden!!")
                            currentField = Left$(currentField, Len(currentField - SterPositie - 1))
                        End If
                        MsgBox(currentField)
                    Next
                Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
                    MsgBox("Line " & ex.Message & "is not valid and will be skipped.")
                End Try
            End While
        End Using
    End Sub

    Protected Overrides Sub OnStop()
        ' Add code here to perform any tear-down necessary to stop your service.

    End Sub

    Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick

    End Sub
End Class
